<html><head><title>ExamineDirectory</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">ExamineDirectory()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#006666"><b>ExamineDirectory</b></font>(#Directory, DirectoryName$, Pattern$)</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Start to examine a directory for listing with the functions <a href="nextdirectoryentry.html">NextDirectoryEntry()</a>, 
<a href="directoryentryname.html">DirectoryEntryName()</a> and <a href="directoryentrytype.html">DirectoryEntryType()</a>. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Directory</i></td>
<td width="90%"> 
A number to identify the new directory listing. <a href="../reference/purebasic_objects.html">#PB_Any</a> can be used as 
a parameter to auto-generate this number. 

</td></tr>
<tr><td><i>DirectoryName$</i></td>
<td> 
The directory to examine. 

</td></tr>
<tr><td><i>Pattern$</i></td>
<td> 
A pattern to filter the returned entries by. 
For example: A 'Pattern$' like "*.*" or "" will list all the files (and sub-directories) in the directory. 
A 'Pattern$' like "*.exe" will list only .exe files (and sub-directories ending with .exe if any). 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns nonzero if the directory can be enumerated or zero if there was an error. If <font color="#924B72">#PB_Any</font> 
was used as the #Directory parameter then the generated directory number is returned. 

</blockquote><p><b>Remarks</b></p><blockquote>

Once the enumeration is done, <a href="finishdirectory.html">FinishDirectory()</a> must 
be called to free the resources associated to the listing. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  Directory$ =<font color="#006666"> GetHomeDirectory</font>() <font color="#006666">; Lists all files and folder in the home directory</font>
  <b><font color="#006666">If</font></b> <font color="#006666">ExamineDirectory</font>(0, Directory$, "*.*")  
    <b><font color="#006666">While</font></b> <font color="#006666">NextDirectoryEntry</font>(0)
      <b><font color="#006666">If</font></b> <font color="#006666">DirectoryEntryType</font>(0) = <font color="#924B72">#PB_DirectoryEntry_File</font>
        Type$ = "[File] "
        Size$ = " (Size: " +<font color="#006666"> DirectoryEntrySize</font>(0) + ")"
      <b><font color="#006666">Else</font></b>
        Type$ = "[Directory] "
        Size$ = "" <font color="#006666">; A directory doesn't have a size</font>
      <b><font color="#006666">EndIf</font></b>
      
      <b><font color="#006666">Debug</font></b> Type$ +<font color="#006666"> DirectoryEntryName</font>(0) + Size$
    <b><font color="#006666">Wend</font></b>
<font color="#006666">    FinishDirectory</font>(0)
  <b><font color="#006666">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="finishdirectory.html">FinishDirectory()</a>, 
<a href="nextdirectoryentry.html">NextDirectoryEntry()</a>, 
<a href="directoryentrytype.html">DirectoryEntryType()</a>, 
<a href="directoryentryname.html">DirectoryEntryName()</a>, 
<a href="directoryentrysize.html">DirectoryEntrySize()</a>, 
<a href="directoryentryattributes.html">DirectoryEntryAttributes()</a>, 
<a href="directoryentrydate.html">DirectoryEntryDate()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=directoryentrytype.html>DirectoryEntryType()</a> - <a href=index.html>FileSystem Index</a> - <a href=filesize.html>FileSize()</a> ->

</body></html>